home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 15 / BBS in a box XV-1.iso / Files / Internet / Web Things / HTML.edit 1.5b1.sit / HTML.edit.1.5b1 / HTML.edit v1.5b1 / HTML.edit v1.5b1.rsrc / TEXT_17760_Linking to Other Documents.txt < prev    next >
Encoding:
Text File  |  1994-11-30  |  4.5 KB  |  102 lines

  1.  
  2. National Center for Supercomputing Applications
  3. A Beginner's Guide to HTML
  4.  
  5. Linking to Other Documents
  6.  
  7. The chief power of HTML comes from its ability to link regions of text (and also images) to another document. The browser highlights these regions (usually with color and/or underlines) to indicate that they are hypertext links (often shortened to  hyperlinks or simply links).  
  8.  
  9. HTML's single hypertext-related tag is <A>, which stands for anchor. To include an anchor in your document: 
  10.  
  11.  1. Start the anchor with <A . (There's a space after the A.) 
  12.  2. Specify the document that's being pointed to by entering the parameter 
  13.    HREF="filename" followed by a closing right angle bracket: > 
  14.  3. Enter the text that will serve as the hypertext link in the current document. 
  15.  4. Enter the ending anchor tag: </A>. 
  16.  
  17. Here is an sample hypertext reference: 
  18.  
  19.     <A HREF="MaineStats.html">Maine</A>
  20.  
  21. This entry makes the word "Maine'' the hyperlink to the document  MaineStats.html, which is in the same directory as the first document. You can link to documents in other directories by specifying the relative path from the current document to the linked document. For example, a link to a file NJStats.html located in the subdirectory AtlanticStates would be:
  22.  
  23.     <A HREF="AtlanticStates/NJStats.html">New Jersey</A>
  24.  
  25. These are called relative links. You can also use the absolute pathname of the file if you wish. Pathnames use the standard UNIX syntax. 
  26.  
  27.  
  28. Relative Links Versus Absolute Pathnames
  29.  
  30. In general, you should use relative links, because 
  31.  
  32.  1. You have less to type. 
  33.  2. It's easier to move a group of documents to another location, because the
  34.    relative path names will still be valid. 
  35.  
  36. However, use absolute pathnames when linking to documents that are not directly related. For example, consider a group of documents that comprise a user manual. Links within this group should be relative links. Links to other documents (perhaps a reference to related software) should use full path names. This way, if you move the user manual to a different directory, none of the links would have to be updated.  
  37.  
  38.  
  39. Uniform Resource Locator
  40.  
  41. The World Wide Web uses Uniform Resource Locators (URLs) to specify the location of files on other servers. A URL includes the type of resource being accessed (e.g., gopher, WAIS), the address of the server, and the location of the file. The syntax is:
  42.  
  43. scheme://host.domain[:port]/path/filename 
  44.  
  45. where scheme is one of 
  46.  
  47. file 
  48.    a file on your local system, or a file on an anonymous FTP server 
  49. http 
  50.    a file on a World Wide Web server 
  51. gopher 
  52.    a file on a Gopher server 
  53. WAIS 
  54.    a file on a WAIS server 
  55. news 
  56.    an Usenet newsgroup 
  57. telnet 
  58.    a connection to a Telnet-based service 
  59.  
  60. The port number can generally be omitted. (That means unless someone tells you otherwise, leave it out.) 
  61.  
  62. For example, to include a link to this primer in your document, you would use 
  63.  
  64.     <A HREF = "http://www.ncsa.uiuc.edu/General/Internet/WWW/HTMLPrimer.html"> 
  65.     NCSA's Beginner's Guide to HTML</A>
  66.  
  67. This would make the text "NCSA's Beginner's Guide to HTML'' a hyperlink to this document. 
  68.  
  69. For more information on URLs, look at 
  70.  
  71. WWW Names and Addresses, URIs, URLs, URNs, written by people at CERN
  72.    http://info.cern.ch/hypertext/WWW/Addressing/Addressing.html
  73.  
  74. A Beginner's Guide to URLs, located on the NCSA Mosaic Help menu 
  75.    http://www.ncsa.uiuc.edu/demoweb/url-primer.html
  76.  
  77.  
  78. Links to Specific Sections in Other Documents
  79.  
  80. Anchors can also be used to move to a particular section in a document. Suppose you wish to set a link from document A and a specific section in document B. (Call this file documentB.html.) First you need to set up a named anchor in document B. For example, to set up an anchor named "Jabberwocky'' to document B, enter  
  81.  
  82.     Here's <A NAME = "Jabberwocky">some text</a>
  83.  
  84. Now when you create the link in document A, include not only the filename, but also the named anchor, separated by a hash mark (#). 
  85.  
  86.     This is my <A HREF = "documentB.html#Jabberwocky">link</A> to document B.
  87.  
  88. Now clicking on the word "link'' in document A sends the reader directly to the words "some text'' in document B. 
  89.  
  90.  
  91. Links to Specific Sections Within the Current Document
  92.  
  93. The technique is exactly the same except the filename is omitted. 
  94.  
  95. For example, to link to the Jabberwocky anchor from within the same file (Document B), use 
  96.  
  97.     This is <A HREF="#Jabberwocky">Jabberwocky link</A> from within Document B.
  98.  
  99. back to Basic Markup Tags
  100. on to Additional Markup Tags
  101. return to Beginner's Guide  Contents.
  102.